#pragma once

#include "stdafx.h"
#include "Matrix.h"

void MultiplyChunked(ChunkedMatrix* m, float* p, float* res)
{
	uint64 n = m->GetCols();
	
	for (uint64 i = 0; i < n; i++)
	{
		res[i] = 0;
	}
	for (uint64 i = 0; i < n; i++)
	{
		for (uint64 j = 0; j < n; j++)
		{
			res[j] += (*m)(i,j) * p[i];
		}
	}
}

void Multiply(Matrix* m, float* p, float* res)
{
	uint64 n = m->GetCols();
	
	for (uint64 i = 0; i < n; i++)
	{
		res[i] = 0;
	}
	for (uint64 i = 0; i < n; i++)
	{
		for (uint64 j = 0; j < n; j++)
		{
			res[j] += (*m)(i,j) * p[i];
		}
	}
}

void MultiplyTransposed(Matrix* m, float* p, float* res)
{
	uint64 n = m->GetCols();
	
	for (uint64 i = 0; i < n; i++)
	{
		res[i] = 0;
	}
	for (uint64 i = 0; i < n; i++)
	{
		for (uint64 j = 0; j < n; j++)
		{
			res[i] += (*m)(j,i) * p[j];
		}
	}
}